package com.ruoyi.project.modules.processBranch.mapper;

import java.util.List;

import com.ruoyi.project.modules.interfaceinfo.domain.VirtualUsage;
import com.ruoyi.project.modules.processBranch.domain.ProcessBranch;
import com.ruoyi.project.modules.processBranch.vo.ParamObject;
import org.apache.ibatis.annotations.Param;

/**
 * 流程分支Mapper接口
 * 
 * @author smallrain
 * @date 2022-04-02
 */
public interface ProcessBranchMapper 
{
    /**
     * 查询流程分支
     * 
     * @param processBranchId 流程分支主键
     * @return 流程分支
     */
    public ProcessBranch selectProcessBranchByProcessBranchId(Long processBranchId);

    /**
     * 查询流程分支列表
     * 
     * @param processBranch 流程分支
     * @return 流程分支集合
     */
    public List<ProcessBranch> selectProcessBranchList(ProcessBranch processBranch);

    /**
     * 新增流程分支
     * 
     * @param processBranch 流程分支
     * @return 结果
     */
    public int insertProcessBranch(ProcessBranch processBranch);

    /**
     * 修改流程分支
     * 
     * @param processBranch 流程分支
     * @return 结果
     */
    public int updateProcessBranch(ProcessBranch processBranch);

    /**
     * 删除流程分支
     * 
     * @param processBranchId 流程分支主键
     * @return 结果
     */
    public int deleteProcessBranchByProcessBranchId(Long processBranchId);

    /**
     * 批量删除流程分支
     * 
     * @param processBranchIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteProcessBranchByProcessBranchIds(String[] processBranchIds);

    int selectMaxSortByInterfaceId(@Param("interfaceId") Long interfaceId);

    int selectMaxSortByLevel(@Param("level") Integer level, @Param("parentId") Long parentId, @Param("interfaceId") Long interfaceId);

    List<Long> selectVirtualUsageIdsByLevelAndParentCode(@Param("level") Integer level, @Param("sortNum")  Integer sortNum, @Param("parentCode") String parentCode);
    List<VirtualUsage> selectVirtualUsageIdsBySortNumAndParentId(@Param("sortNum")  Integer sortNum, @Param("parentId") Long parentId,@Param("interfaceId")  Long interfaceId);

    ProcessBranch selectProcessBranchByCode(@Param("code") String code);

    List<ParamObject> paramObjectList(@Param("interfaceType") String interfaceType,
                                      @Param("interfaceIds") List<Long> interfaceId,
                                      @Param("isInParam") String isInParam,
                                      @Param("objectType") String objectType);

    List<ParamObject> queryParamFieldList(@Param("id") Long id);

    List<ProcessBranch> selectProcessBranchByProcessBranchCode(@Param("processBranchCode") String processBranchCode);

    void batchDelete(@Param("processBranchIds") List<Long> processBranchIds);

    void updateSortNum(@Param("level") Integer level, @Param("sortNum") Integer sortNum, @Param("parentId") Long parentId, @Param("interfaceId") Long interfaceId);

    String getMaxCodeByParentId(@Param("parentProcessBranchId")Long parentProcessBranchId);

    List<VirtualUsage> selectVirtualUsageIdsByLevel(@Param("level") Long level, @Param("interfaceId") Long interfaceId);

    List<ProcessBranch> selectProcessBranchListByLevelAndSortNum(ProcessBranch preProcessBranch);
}
